package com.bush.mall.coupon.controller;

import org.springframework.web.bind.annotation.*;
import com.bush.mall.common.entity.Result;;
import com.bush.mall.coupon.entity.SpuBoundsEntity;
import com.bush.mall.coupon.service.SpuBoundsService;
import javax.annotation.Resource;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;

/**
 * 商品spu积分设置
 * @author RUN
 * @date 2022-11-29
 */
@RestController
@RequestMapping("spubounds")
@Api(tags = "商品spu积分设置管理" )
public class SpuBoundsController {

    @Resource(name= SpuBoundsService.BEAN_ID)
    private SpuBoundsService spuBoundsService;

    /**
     * 分页查询商品spu积分设置列表
     * @author RUN
     * @date 2022-11-29
     */
    @ApiOperation(value = "分页查询商品spu积分设置列表")
    @GetMapping("queryForPage")
    public Result queryForPage(Integer current,Integer size){
        return spuBoundsService.queryForPage(current,size);
    }

    /**
     * 保存商品spu积分设置表单
     * @author RUN
     * @date 2022-11-29
     */
    @ApiOperation(value = "保存商品spu积分设置表单")
    @PostMapping
    public Result saveSpuBounds(@RequestBody SpuBoundsEntity spuBounds){
        return spuBoundsService.saveSpuBounds(spuBounds);
    }

    /**
     * 修改商品spu积分设置表单
     * @author RUN
     * @date 2022-11-29
     */
    @ApiOperation(value = "修改商品spu积分设置表单")
    @PutMapping
    public Result updateSpuBounds(@RequestBody SpuBoundsEntity spuBounds){
        return spuBoundsService.updateSpuBounds(spuBounds);
    }

    /**
     * 通过指定id删除商品spu积分设置
     * @author RUN
     * @date 2022-11-29
     */
    @ApiOperation(value = "通过指定id删除商品spu积分设置")
    @DeleteMapping
    public Result deleteSpuBounds(Long id){
        return spuBoundsService.deleteSpuBounds(id);
    }

}
